import "./index.scss"
import React, { Component } from 'react'
import { Layout, Menu, Breadcrumb } from 'antd';
import { Switch, Route, Redirect } from "react-router-dom"

import lazyload from "../../utils/lazyLoad";
import MyMenu from "./myMenu";
const { Header, Content, Footer, Sider } = Layout;
const { SubMenu } = Menu;
export default class Main extends Component {

    render() {
        return (

            <Layout className="mainPage" style={{ minHeight: '100vh' }}>
                {/* 侧边栏 */}
                <MyMenu />
                <Layout className="site-layout">
                    {/* <Header className="site-layout-background" style={{ padding: 0 }} /> */}
                    <Content style={{ margin: '0 16px', display: "flex", flexDirection: "column" }}>
                        {/* <Breadcrumb style={{ margin: '16px 0', width: "100%" }}>
                            <Breadcrumb.Item>User</Breadcrumb.Item>
                            <Breadcrumb.Item>Bill</Breadcrumb.Item>
                        </Breadcrumb> */}
                        <div className="site-layout-background" style={{ width: "100%", flex: 1, padding: 5, minHeight: 360 }}>
                            <Switch>
                                <Route path="/main" exact render={() => <Redirect to="/main/home" />} />
                                <Route path="/main/home" component={lazyload(() => import("./home"))} />


                                {/* 员工管理 */}
                                <Route path="/main/user" component={
                                    (() => (
                                        <Switch>
                                            <Route path="/main/user" exact render={() => <Redirect to="/main/user/userList" />} />
                                            <Route path="/main/user/userList" component={lazyload(() => import("./user/userList"))} />
                                            <Route path="/main/user/addUser" component={lazyload(() => import("./user/addUser"))} />
                                            <Route path="/main/user/*" exact render={() => <Redirect to="/main/user/userList" />} />
                                        </Switch>
                                    ))
                                } />

                                {/* 考勤管理 */}
                                <Route path="/main/user" component={
                                    (() => (
                                        <Switch>
                                            <Route path="/main/user" exact render={() => <Redirect to="/main/user/userList" />} />
                                            <Route path="/main/user/userList" component={lazyload(() => import("./user/userList"))} />
                                            <Route path="/main/user/addUser" component={lazyload(() => import("./user/addUser"))} />
                                            <Route path="/main/user/*" exact render={() => <Redirect to="/main/user/userList" />} />
                                        </Switch>
                                    ))
                                } />

                                <Route path="/main/*" render={() => <Redirect to="/main/home" />} />
                            </Switch>
                        </div>
                    </Content>
                    <Footer style={{ textAlign: 'center' }}>企业管理系统 Design ©2021 Created by Mr.Y</Footer>
                </Layout>
            </Layout>

        )
    }
}
